<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript" src="/scripts/jquery/jquery-1.7.1.js"></script>
    <link href="/style/authority/basic_layout.css" rel="stylesheet" type="text/css">
    <link href="/style/authority/common_style.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="/scripts/authority/commonAll.js"></script>
    <script type="text/javascript" src="/scripts/fancybox/jquery.fancybox-1.3.4.js"></script>
    <script type="text/javascript" src="/scripts/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
    <link rel="stylesheet" type="text/css" href="/style/authority/jquery.fancybox-1.3.4.css" media="screen"></link>
    <script type="text/javascript" src="/scripts/artDialog/artDialog.js?skin=default"></script>
    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.4/css/bootstrap.min.css">
    <title>房屋信息销售列表</title>
    {{--<script type="text/javascript">
        $(document).ready(function(){
            /** 新增   **/
            $("#addBtn").fancybox({
                'href'  : 'house_edit.html',
                'width' : 733,
                'height' : 530,
                'type' : 'iframe',
                'hideOnOverlayClick' : false,
                'showCloseButton' : false,
                'onClosed' : function() {
                    window.location.href = 'house_list.html';
                }
            });

            /** 导入  **/
            $("#importBtn").fancybox({
                'href'  : '/xngzf/archives/importFangyuan.action',
                'width' : 633,
                'height' : 260,
                'type' : 'iframe',
                'hideOnOverlayClick' : false,
                'showCloseButton' : false,
                'onClosed' : function() {
                    window.location.href = 'house_list.html';
                }
            });

            /**编辑   **/
            $("a.edit").fancybox({
                'width' : 733,
                'height' : 530,
                'type' : 'iframe',
                'hideOnOverlayClick' : false,
                'showCloseButton' : false,
                'onClosed' : function() {
                    window.location.href = 'house_list.html';
                }
            });
        });
        /** 用户角色   **/
        var userRole = '';

        /** 模糊查询来电用户  **/
        function search(){
            $("#submitForm").attr("action", "house_list.html?page=" + 1).submit();
        }

        /** 新增   **/
        function add(){
            $("#submitForm").attr("action", "/xngzf/archives/luruFangyuan.action").submit();
        }

        /** Excel导出  **/
        function exportExcel(){
            if( confirm('您确定要导出吗？') ){
                var fyXqCode = $("#fyXq").val();
                var fyXqName = $('#fyXq option:selected').text();
//	 		alert(fyXqCode);
                if(fyXqCode=="" || fyXqCode==null){
                    $("#fyXqName").val("");
                }else{
//	 			alert(fyXqCode);
                    $("#fyXqName").val(fyXqName);
                }
                $("#submitForm").attr("action", "/xngzf/archives/exportExcelFangyuan.action").submit();
            }
        }

        /** 删除 **/
        function del(fyID){
            // 非空判断
            if(fyID == '') return;
            if(confirm("您确定要删除吗？")){
                $("#submitForm").attr("action", "/xngzf/archives/delFangyuan.action?fyID=" + fyID).submit();
            }
        }

        /** 批量删除 **/
        function batchDel(){
            if($("input[name='IDCheck']:checked").size()<=0){
                art.dialog({icon:'error', title:'友情提示', drag:false, resize:false, content:'至少选择一条', ok:true,});
                return;
            }
            // 1）取出用户选中的checkbox放入字符串传给后台,form提交
            var allIDCheck = "";
            $("input[name='IDCheck']:checked").each(function(index, domEle){
                bjText = $(domEle).parent("td").parent("tr").last().children("td").last().prev().text();
// 			alert(bjText);
                // 用户选择的checkbox, 过滤掉“已审核”的，记住哦
                if($.trim(bjText)=="已审核"){
// 				$(domEle).removeAttr("checked");
                    $(domEle).parent("td").parent("tr").css({color:"red"});
                    $("#resultInfo").html("已审核的是不允许您删除的，请联系管理员删除！！！");
// 				return;
                }else{
                    allIDCheck += $(domEle).val() + ",";
                }
            });
            // 截掉最后一个","
            if(allIDCheck.length>0) {
                allIDCheck = allIDCheck.substring(0, allIDCheck.length-1);
                // 赋给隐藏域
                $("#allIDCheck").val(allIDCheck);
                if(confirm("您确定要批量删除这些记录吗？")){
                    // 提交form
                    $("#submitForm").attr("action", "/xngzf/archives/batchDelFangyuan.action").submit();
                }
            }
        }

        /** 普通跳转 **/
        function jumpNormalPage(page){
            $("#submitForm").attr("action", "house_list.html?page=" + page).submit();
        }

        /** 输入页跳转 **/
        function jumpInputPage(totalPage){
            // 如果“跳转页数”不为空
            if($("#jumpNumTxt").val() != ''){
                var pageNum = parseInt($("#jumpNumTxt").val());
                // 如果跳转页数在不合理范围内，则置为1
                if(pageNum<1 | pageNum>totalPage){
                    art.dialog({icon:'error', title:'友情提示', drag:false, resize:false, content:'请输入合适的页数，\n自动为您跳到首页', ok:true,});
                    pageNum = 1;
                }
                $("#submitForm").attr("action", "house_list.html?page=" + pageNum).submit();
            }else{
                // “跳转页数”为空
                art.dialog({icon:'error', title:'友情提示', drag:false, resize:false, content:'请输入合适的页数，\n自动为您跳到首页', ok:true,});
                $("#submitForm").attr("action", "house_list.html?page=" + 1).submit();
            }
        }
    </script>--}}
    <style>
        .alt td{ background:black !important;}
    </style>
</head>
<script src="/layer/layer.js"></script>
<script src="/js/jquery-1.8.3.js"></script>
<input type="hidden" name="_token" id='token' value="{{csrf_token()}}"/>
<body>
<form id="submitForm" name="submitForm" action="" method="post">
    <input type="hidden" name="allIDCheck" value="" id="allIDCheck"/>
    <input type="hidden" name="fangyuanEntity.fyXqName" value="" id="fyXqName"/>
    <div id="container">
        <div class="ui_content">
            <div class="ui_text_indent">
                <div id="box_border">
                    <div id="box_top">搜索</div>
                    <div id="box_center">
                        房间号
                        <input type="text" id="fyZldz" name="fangyuanEntity.fyZldz" class="ui_input_txt02" />

                       销售人员
                        <input type="text" id="fyZldz" name="fangyuanEntity.fyZldz" class="ui_input_txt02" />
                        客户
                        <input type="text" id="fyZldz" name="fangyuanEntity.fyZldz" class="ui_input_txt02" />

                        <input type="button" value="查询" class="ui_input_btn01" onclick="search();" />


                    </div>
                    <div id="box_bottom">

                        <input type="button" value="新增" class="ui_input_btn01" id="test1" />
                        <input type="button" value="返回销售表" class="ui_input_btn01" onclick="Return();" />
                        {{--<input type="button" value="修改" class="ui_input_btn01" onclick="" />
                        <input type="button" value="删除" class="ui_input_btn01" onclick="" />--}}

                    </div>
                </div>
            </div>
        </div>
        <div class="ui_content">
            <div class="ui_tb">
                <table class="table" cellspacing="0" cellpadding="0" width="100%" align="center" border="0">
                    <tr>
                        <th width="30"><input type="checkbox" id="all" onclick="selectOrClearAllCheckbox(this);" />
                        </th>
                        <th>ID</th>
                        <th>房间号</th>
                        <th>客户</th>
                        <th>销售员</th>
                        <th>详情</th>
                        <th>时间</th>
                        <th>状态</th>
                        <th>次数</th>
                        <th>操作</th>
                    </tr>
                    @foreach($data as $v)
                        <tr>
                            <td><input type="checkbox" name="IDCheck" value="14458579642011" class="acb" /></td>


                            <td>{{$v->id}}</td>
                            <td>{{$v->room_id}}</td>
                            <td>{{$v->user_id}}</td>
                            <td>{{$v->sale_id}}</td>
                            <td>{{$v->details}}</td>
                            <td>{{$v->time}}</td>
                            <td>{{$v->status}}</td>
                            <td>{{$v->number}}</td>
                            <td>
                                <a href="{{url('/admin/journal_update')}}?id=<?php echo $v->id; ?>">修改</a>

                                <a href="javascript:del(this,{{$v->id}});">删除</a>
                            </td>
                        </tr>

                    @endforeach

                </table>
            </div>
            <center>{{ $data->links() }}</center>

    </div>
</form>

</body>
</html>

<script type="text/javascript">
//弹出层
$('#test1').on('click', function(){
    layer.open({
        type: 2,
        title: '添加日志',
        maxmin: true,
        shadeClose: true, //点击遮罩关闭层
        area : ['800px' , '520px'],
        content:"{{url('/admin/journal_add')}}"
    });
});

    //返回销售列表

    function Return(){
        location.href="{{url('/admin/saleList')}}"
    }
    //查询
    function search()
    {
        var options=$("#select1 option:selected");
        var house_region = options.val();

        var options=$("#select2 option:selected");
        var house_village_name = options.val();

        var options=$("#select3 option:selected");
        var house_price = options.val();

        var options=$("#select4 option:selected");
        var is_lease = options.val();

        console.log(house_region);
        console.log(house_village_name);
        console.log(house_price);
        console.log(is_lease);




        var token=$('#token').val();


        var data = new FormData();
        data.append('house_region', house_region);
        data.append('house_village_name',house_village_name);
        data.append('house_price', house_price);
        data.append('is_lease', is_lease);
        data.append('_token', token);
        $.ajax({
            type:'post',
            url:"{{url('/admin/search')}}",
            data:data,
            cache: false,
            processData: false,
            contentType: false,
            success:function(msg){
                if(msg == 1){
                    alert('添加OK');
                    window.parent.location.reload();//刷新父界面
                    var index = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(index);//关闭弹出层
                }else{
                    alert('添加失败');
                    var index = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(index);//关闭弹出层
                }
            }
        });
    }


/*删除*/
function del(obj,id) {
    $.ajax({
        type: 'GET',
        url: "{{url('admin/journal_del')}}",
        data: 'id=' + id,
        success: function (msg) {

            if (msg == 1) {
                alert('删除角色成功 !');
                parent.location.reload(); // 父页面刷新
            } else if (msg == 0) {
                alert('删除用户成功 ！');
                parent.location.reload(); // 父页面刷新

            }
            else {
                parent.location.reload(); // 父页面刷新

                alert('NO ！');
            }
        }
    });

}









    function journal()
    {
        location.href="{{url('/admin/journal')}}"
    }
</script>